<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateProjectGovernments extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('project_governments', function (Blueprint $table) {
            $table->id()->from(config('migration.from'));

            $table->string('type_key')->unsigned();
            $table->foreign('type_key')->references('key')->on('types')->onDelete('restrict')->onUpdate('restrict');

            $table->jsonb('participants')->default(json_encode([]))->comment('Общее собрание: участники');

            $table->text('body_name')->nullable();
            $table->text('participants_name')->nullable();

            $table->jsonb('persons_information')->default(json_encode([]))->comment('Сведения о лицах');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('project_governments');
    }
}
